package org.su.webadapter.velocity;

import org.apache.velocity.exception.ParseErrorException;
import org.apache.velocity.exception.ResourceNotFoundException;
import org.apache.velocity.runtime.resource.Resource;
import org.apache.velocity.runtime.resource.ResourceManagerImpl;

public class SSHResourceManager extends ResourceManagerImpl
{
	
	/**
	 * 判断是否为新模板，已更新范存
	 */
	public static final String prefix = "remove:";
	@Override
	public Resource getResource(String resourceName, int resourceType,
			String encoding) throws ResourceNotFoundException,
			ParseErrorException, Exception {
		  
		if(resourceName.startsWith(prefix)){
			resourceName = resourceName.substring(prefix.length());
			String resourceKey = resourceType + resourceName;
	        globalCache.remove(resourceKey);
	        return null;
		}
		
		return super.getResource(resourceName, resourceType,encoding);
	}
  

}
